package com.woniu.supermarket.web;

import com.woniu.supermarket.result.ResultResponse;
import com.woniu.supermarket.service.IOutboundDetailService;
import com.woniu.supermarket.vo.OutboundDetailVo;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("OutboundDetail")
@Api(value = "出库详情操作")
public class OutboundDetailController {

    @Autowired
    IOutboundDetailService iOutboundDetailService;

    @GetMapping("/showOutboundDetail/{id}")
    public ResultResponse<List<OutboundDetailVo>> showOutboundDetail(@PathVariable("id")Integer id){
        ResultResponse<List<OutboundDetailVo>> result = null;
        try {
            List<OutboundDetailVo> lists = iOutboundDetailService.findByOutboundId(id);
            result = new ResultResponse<>(200,"查询出库详情成功",lists);
        }catch (RuntimeException e){
            e.printStackTrace();
            result = new ResultResponse<>(201,"查询出库详情失败");
        }
        return result;
    }
}
